extends Node2D
class_name Cursor

@onready var timer: Timer = $Timer
@onready var spr: Sprite2D = $Sprite2D


func _ready() -> void:
	timer.timeout.connect(switchVisible)
	

func _exit_tree() -> void:
	timer.timeout.disconnect(switchVisible)
	

func switchVisible():
	spr.visible = !spr.visible
	

func changeColor2Brown():
	spr.frame_coords = Vector2(0, 0)
	

func changeColor2White():
	spr.frame_coords = Vector2(0, 1)
	

func restartFromVisible():
	timer.stop()
	spr.visible = true
	timer.start()
	

func stopBlink():
	timer.stop()
	visible = true
	

func resumeBlink():
	timer.start()
	

func setCell(cell):
	position = GlobalUtils.cell2Pos(cell)
	

func getCell():
	return GlobalUtils.pos2Cell(position)
	
